/*
 * NyuSymtbl.hpp
 *
 *  Created on: 2010/05/24
 *      Author: mitsu
 */

#ifndef NYUSYMTBL_HPP_
#define NYUSYMTBL_HPP_

#include <map>
#include "NyuValue.hpp"

class NyuSymtbl {
public:
    unsigned int getIndex(void* str, int);

    static void initialize();
    static void finalize();

    static NyuSymtbl* getInstance() {
        return instance_;
    }

    static unsigned int getIndex(void* str) {
        return instance_->getIndex(str, 0);
    }

    static size_t getSize() {
        return instance_->idx_map_.size();
    }

private:
    NyuSymtbl();
    ~NyuSymtbl();

private:
    typedef std::map<void*, unsigned int> idx_map_t;
    idx_map_t idx_map_;

    static NyuSymtbl* instance_;
};

#endif /* NYUSYMTBL_HPP_ */
